#ifndef DATA_HELPER_HPP
#define DATA_HELPER_HPP

#include "content/bindable.hpp"
#include "utils/safe_value.hpp"

template <typename Class, typename Type>
inline std::tuple<value_type, std::any> make_data(Class *cls, Type (Class::*field_ptr)) {
    return std::make_tuple((value_type)value_traits<Type>::store_type, &(cls->*field_ptr));
}

template <typename Class, typename Type>
inline std::tuple<value_type, std::any> make_data(Class *cls, Type* (Class::*field_ptr)) {
    return std::make_tuple((value_type)value_traits<Type>::store_type, (cls->*field_ptr));
}

template <typename Class>
inline std::tuple<value_type, std::any> make_data(Class *cls, ImageContent* (Class::*field_ptr)) {
    return std::make_tuple(value_type::IMAGE, &(cls->*field_ptr));
}

template <typename Class>
inline std::tuple<value_type, std::any> make_data(Class *cls, ui_view* (Class::*field_ptr)) {
    return std::make_tuple(value_type::UI, &(cls->*field_ptr));
}

template <typename Class, typename Type>
inline std::tuple<value_type, std::any> make_data(Class *cls, basic_data<Type> (Class::*field_ptr)) {
    return std::make_tuple((value_type)value_traits<Type>::store_type, &((cls->*field_ptr).value));
}

#endif // DATA_HELPER_HPP
